/*
 * Copyright © 2023 广州宏天软件股份有限公司 hotent
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.hotent.project.auth.model;

import com.hotent.uc.api.model.IUser;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.Map;

/**
 * security用户认证对象
 */
public class BaseUserDetails implements IUser {
    private static final long serialVersionUID = -47458854186013987L;

    private String account;
    private String userId;
    private String fullname;
    private String password;

    /**
     * 用户授权信息
     */
    protected Collection<SimpleGrantedAuthority> authorities;

    @Override
    public boolean isEnable() {
        return true;
    }

    @Override
    public Map<String, String> getAttributes() {
        return null;
    }

    @Override
    public String getAttrbuite(String s) {
        return null;
    }

    @Override
    public Integer getStatus() {
        return null;
    }

    @Override
    public String getPhoto() {
        return null;
    }

    @Override
    public String getWeixin() {
        return null;
    }

    @Override
    public Integer getHasSyncToWx() {
        return null;
    }

    @Override
    public String getTenantId() {
        return null;
    }

    @Override
    public LocalDateTime getPwdCreateTime() {
        return null;
    }

    @Override
    public String getClientId() {
        return null;
    }

    @Override
    public String getClientToken() {
        return null;
    }

    @Override
    public LocalDate getEntryDate() {
        return null;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return this.authorities;
    }

    public void setAuthorities(Collection<SimpleGrantedAuthority> authorities) {
        this.authorities = authorities;
    }

    @Override
    public String getUsername() {
        return account;
    }

    @Override
    public String getUserId() {
        return userId;
    }

    @Override
    public void setUserId(String userId) {
        this.userId = userId;
    }

    @Override
    public String getFullname() {
        return fullname;
    }

    @Override
    public void setFullname(String fullname) {
        this.fullname = fullname;
    }

    @Override
    public String getAccount() {
        return account;
    }

    @Override
    public void setAccount(String account) {
        this.account = account;
    }

    @Override
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public String getEmail() {
        return null;
    }

    @Override
    public String getMobile() {
        return null;
    }

    @Override
    public void setAttributes(Map<String, String> map) {

    }

    @Override
    public boolean isAdmin() {
        return true;
    }

    @Override
    public boolean isAccountNonExpired() {
        return isEnable();
    }

    @Override
    public boolean isAccountNonLocked() {
        return isEnable();
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return isEnable();
    }

    @Override
    public boolean isEnabled() {
        return isEnable();
    }

    @Override
    public String getIdentityType() {
        return null;
    }
}